#include "Context.h"

Context::Context()
{
    this->setState(new ConcreteStateStop());
}

Context::Context(State *state)
{
    this->setState(state);
}

Context::~Context()
{
    delete m_state;
}

void Context::setState(State *state)
{
    if (this->m_state != nullptr)
        delete this->m_state;
    this->m_state = state;
}

State *Context::getState()
{
    return this->m_state;
}

void Context::doAction()
{
    this->m_state->doAction(this);
}